export const getUrlParams = (url?: string) => {
  if (typeof url !== 'string') return {};
  const paramsStr = url.split('?')[1];
  if (!paramsStr) return {};
  return paramsStr.split('&').reduce((pre, cur) => {
    const [key, value] = cur.split('=');
    return { ...pre, [key]: value };
  }, {} as Record<string, string>);
};
